Fix PAE overflow in xc_linux_build.
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 12 Oct 2005 08:31:53 +0000 (09:31 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 12 Oct 2005 08:31:53 +0000 (09:31 +0100)
Signed-off-by: srparish@us.ibm.com
tools/libxc/xc_linux_build.c

index 2c984bf5eac3a6459d7d53fb0c52c3649bcf0565..3b0f28676f62de363ea7fe15aaff077ba54bce60 100644 (file)
@@ -500,11 +500,11 @@ static int setup_guest(int xc_handle,
            _p(dsi.v_start), _p(v_end));
     printf(" ENTRY ADDRESS: %p\n", _p(dsi.v_kernentry));
 
-    if ( (v_end - dsi.v_start) > (nr_pages * PAGE_SIZE) )
+    if ( ((v_end - dsi.v_start)>>PAGE_SHIFT) > nr_pages )
     {
-        PERROR("Initial guest OS requires too much space\n"
+        printf("Initial guest OS requires too much space\n"
                "(%luMB is greater than %luMB limit)\n",
-               (v_end-dsi.v_start)>>20, (nr_pages<<PAGE_SHIFT)>>20);
+               (v_end-dsi.v_start)>>20, nr_pages>>(20-PAGE_SHIFT));
         goto error_out;
     }